<?php
$act = $_REQUEST['act'];


include "../../../lib/DB.php";
$db = new DB();
$table = 'user_register';
$data = $_GET;
if($act == 'add')
{
    $data = $_REQUEST;
    unset($data['act'],$data['id'],$data['change'],$data['act']);
    $data['createtime'] = date('Y-m-d H:i:s',time());
    $id = $db->table($table)->insert($data);
    echo "<script >alert('添加成功..');location.href='user.php'</script>";
    exit;
}
if($act == 'edit')
{

    $id = $_POST['id'];
    $data = $_POST;
    unset($data['act'],$data['id'],$data['change']);

    $db = $db->table($table)->where(['id' => $id])->update($data);

    echo "<script >alert('修改成功..');location.href='user.php'</script>";
    exit;
}
if($act == 'del')
{
    $id = $_GET['gid'];
    $db->table($table)->where(['gid' => $id])->delete();
    echo "<script >alert('删除成功..');location.href='goods.php'</script>";
    exit;

}